package com.technology.education.data.model

import android.os.Parcel
import android.os.Parcelable

/**
 *@author:create by BZY
 *Date: 2022/3/17 14
 * 积分商城商品列表
 */

data class GoodsListModel(
    val list: List<GoodsList>,
    val pageNo: Int,
    val pageSize: Int,
    val total: Int
)

data class GoodsList(
    val coverImage: String?,
    val description: String?,
    val id: String,
    val inventory: Int,
    val name: String,
    val price: Int
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString() ?: "",
        parcel.readInt(),
        parcel.readString() ?: "",
        parcel.readInt()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(coverImage)
        parcel.writeString(description)
        parcel.writeString(id)
        parcel.writeInt(inventory)
        parcel.writeString(name)
        parcel.writeInt(price)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<GoodsList> {
        override fun createFromParcel(parcel: Parcel): GoodsList {
            return GoodsList(parcel)
        }

        override fun newArray(size: Int): Array<GoodsList?> {
            return arrayOfNulls(size)
        }
    }
}